import request from '@/utils/request'

// 查询设备列表
export function listDevice(query) {
  return request({
    url: '/hospital/device/list',
    method: 'get',
    params: query
  })
}
// 查询设备状态
export function statisticsState(hospitalId) {
  return request({
    url: `/hospital/warning/statisticsStateToMP/${hospitalId}`,
    method: 'get',
  })
}

// 查询科室对应的一类类别名称列表
export function optionOneClass(departmentId) {
  return request({
    url: '/hospital/device/oneDeviceName/' + departmentId,
    method: 'get',
  })
}

// 查询科室以及一类对应的二类类别名称列表
export function optionTwoDeviceClass(departmentId, oneClassId) {
  return request({
    url: '/hospital/device/twoDeviceName/' + departmentId + '/' + oneClassId,
    method: 'get',
  })
}


// 查询设备详细
export function getDevice(deviceId) {
  return request({
    url: '/hospital/device/' + deviceId,
    method: 'get'
  })
}

// 新增设备
export function addDevice(data) {
  return request({
    url: '/hospital/device',
    method: 'post',
    data: data
  })
}
// 批量新增设备
export function addsDevice(data) {
  return request({
    url: '/hospital/device/adds',
    method: 'post',
    data: data
  })
}

// 修改设备
export function updateDevice(data) {
  return request({
    url: '/hospital/device',
    method: 'put',
    data: data
  })
}

// 删除设备
export function delDevice(deviceId) {
  return request({
    url: '/hospital/device/' + deviceId,
    method: 'delete'
  })
}

// 查询设备生命周期
export function getDeviceLifeCycle(deviceId) {
  return request({
    url: '/hospital/device/lifeCycle/' + deviceId,
    method: 'get',
  })
}

// 获取设备小程序二维码
export function getDeviceMPCode(params) {
  return request({
    url: '/hospital/device/mpCode',
    method: 'get',
    params: {
      ...params,
      env: process.env.VUE_APP_MP_ENV
    }
  })
}
// 获取APP二维码
export function getDeviceAPPCode(deviceId) {
  return request({
    url: `/hospital/device/appCode/${deviceId}`,
    method: "get",
  })
}

export function getLifeCycleReport(deviceId) {
  return request({
    url: `/hospital/device/lifeCycleReport/${deviceId}`,
    method: "get",
  })
}
